1. Field of the Invention
The present invention relates to a method of and a device for supporting tests performed on an application program which, as a client, performs transaction processing on a database via a database server.
2. Description of the Related Art
Client/server database system includes two processing forms: (1) a database management system (DBMS) directly accepts transactions from clients (application programs), and (2) a transaction processing monitor (TP monitor) intervenes between clients and the DBMS to accept transactions from the clients on a batch basis.
When the TP monitor is used, a client application and a server application must be created as an application program. When the TP monitor is not used, on the other hand, it is required to create only an application that describes instructions for transaction control and database manipulation.
In making a unit test of an application in the client/server system in which the TP monitor is not used, the DBMS actually needs to be used for the purpose of performing a syntax check on the description of the database manipulation instructions. In this case, however, since there is a possibility that the database may be destroyed by each unit application, an individual database for testing must be created for each application. That is, at the time of application unit test, a single database cannot be shared among a number of applications, failing efficient utilization of resources.
For the application test, not only a test at the time of normal processing but also a test for abnormal processing in the event of the occurrence of abnormality in a database will be needed. In such a case, an application must be rewritten in order to cause abnormality to occur deliberately. That is, the test for abnormal processing cannot be performed in an efficient manner.
A person who developed a database system may require to confirm the contents of the database which are modified by an application during transaction execution. However, the DBMS performs transaction control in such a way as to ensure the isolation or serializability of transactions; thus, other transactions are not permitted to see the intermediate results of a transaction. For this reason, for example, a debugger is not allowed to reference and update the contents of the database in the middle of application processing.
Here, the isolation or serializability of transactions in the DBMS will be described. In a database system, even when two or more applications cause simultaneous requests to update the database, data integrity must be ensured. For this reason, when two or more accesses are made simultaneously, the corresponding requests will be serviced in sequence. This is what is called transaction processing. A transaction is defined as a significant process for which the DBMS is requested by each application.
If, while an application is performing a data update process on a database, i.e., a transaction for updating a piece of data in the database, a different application attempts to reference that data in the database, it will refer to the intermediate results of that transaction, i.e., partially updated data. This may result in wrong results of a transaction by the different application. Therefore, exclusive control is used to prevent access to the database by other transactions than a transaction that is updating the database. Thereby, access to the database by each application will be made independently and serially. Thus, by executing transactions, which access the same database through the DBMS, independently and serially, the intermediate results of a transaction will be concealed from any other transaction.
In such a client/server system, the following facilities will be useful in debugging applications.
(1) When an application updates the contents of a database by transaction execution, it is restored to the state it had prior to the start of the transaction execution. This is performed without making any modification to the application.
(2) A return code from a database server for an database manipulation instruction issued by an application is altered without making any modification to the application.
(3) An operation of referencing and updating the contents of a database, which is being updated by an application, among transactions is performed without making any modification to the application.
Next, conventional problems encountered in implementing the above facilities (1), (2) and (3) will be described.
First, FIG. 1 is a diagram useful in explaining conventional problems with the facility (1). In this figure, application 1 is a client process, and DB server 2 is a server process that the DBMS activates in response to receipt of a transaction start instruction from application 1. Processes 1 and 2 communicate messages with each other by interprocess communications and performs transaction processing on database 3.
Upon receipt of a message that instructs the start of a transaction from application 1, DB server 2 maintains that transaction therein. Upon receipt of a database manipulation instruction from application 1, the DB server makes a structure analysis and a relational analysis of database 3 and then executes that instruction to reference and updates data in database 3. The DB server continues updating the contents of database 3 until it receives from application 1 a message describing the termination of that transaction. Upon receipt of that message, the DB server deletes the transaction in execution, whereby that transaction is terminated.
Thus, direct access to database 3 is made by DB server 2, i.e., the DBMS including the DB server. In order to restore the contents updated by the transaction to the state prior to the start of the transaction, therefore, application 1 or the DBMS must perform the restoration processing. In order not to modify application 1, therefore, it is required to incorporate a restoration facility into the DBMS. This requires a lot of work and is costly to develop.
FIG. 2 is a diagram useful in explaining conventional problems with the facility (2). Upon receipt of a database manipulation instruction from application 1, the DB server executes that instruction and then returns to application 1 a return code indicating the results of access made to database 3. At debug time, it is required to change the return code deliberately in order to test exceptional processing (e.g., error processing) within application 1. To this end, it is required to incorporate a facility for that purpose into part of application 1 only for debugging, which needs modifications to application 1.
FIG. 3 is a diagram for use in explanation of conventional problems with the facility (3).
This figure illustrates a case where terminal 4 initiates debugger 5 for debugging application 1. While application 1 is debugged, there are times when it is desired to make a reference to the contents updated by application 1 during transaction execution through debugger 5 or when it is desired to modify part of database 3 by debugger 5 during transaction execution. In this case, in order to ensure the logical consistency of the contents of database 3, it is required for debugger 5 to perform such a debug operation as described above by another transaction. This is because, when debugger 5 updates database 3 without declaring to the DBMS that a transaction is started, operations on database 3 may be executed in an order difficult to ensure the consistency of database 3. In such a case, application 1 would be terminated abnormally.
However, when debugger 5 attempts to perform the above debug operation by a transaction different from that of application 1, debugger 5 and application 1 will make access to the same resource on database 3; thus, the transaction of debugger 5 is placed in the exclusive wait state by DB server 2. Eventually it becomes impossible for debugger 5 to perform the above debug operation.
To perform the above debug operation, therefore, it is required to modify application 1 so as to incorporate a statement for that debug operation into application 1.
Thus, it is conventionally required to incorporate a debugging process into application 1 in order to test (debug) it. In order not to modify application 1, it is required to add some facility to the DBMS (in the case of the above facility (1)).
However, the way to incorporate a debug facility into application 1 cannot be said to be efficient because that facility must be incorporated into each application and this requires a lot of work. In addition, at the time of shipment of applications after their performance has been checked, work is also required to modify them again for the purpose of removing a facility incorporated for debugging purposes, resulting in reduced application development efficiency.